home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 May / macformat-024.iso / Shareware City / Graphics / EPS Fixer 1.5 / Scripting EPS Fixer / Droppable EPS Fixer (text) < prev    next >
Encoding:
Text File  |  1995-01-22  |  1.1 KB  |  41 lines  |  [TEXT/ToyS]

  1. on open fileDropList
  2.     set theCount to count of fileDropList
  3.     set filesProcessed to 0
  4.     tell application "EPS Fixer" to activate
  5.     repeat with i from 1 to theCount
  6.         set theFile to item i of fileDropList as alias
  7.         set theInfo to info for theFile
  8.         set theType to file type of theInfo
  9.         if theType = "TEXT" or theType = "EPSF" then
  10.             ProcessFiles(theFile)
  11.             set filesProcessed to filesProcessed + 1
  12.         end if
  13.     end repeat
  14.     tell application "EPS Fixer" to quit
  15.     if filesProcessed > 0 then
  16.         if filesProcessed is equal to 1 then
  17.             set resultString to "One file was processed."
  18.         else
  19.             set resultString to {theCount, " files were processed."} as string
  20.         end if
  21.     else
  22.         set resultString to {"No files were processed."} as string
  23.     end if
  24.     display dialog resultString buttons "OK" with icon 1 default button 1
  25. end open
  26.  
  27. on ProcessFiles(theFile)
  28.     set theName to name of (the info for theFile)
  29.     tell application "EPS Fixer"
  30.         open theFile
  31.         save document theName
  32.         close window theName
  33.     end tell
  34. end ProcessFiles
  35.  
  36. on run
  37.     set theFile to (choose file of type {"TEXT", "EPSF"}) as alias
  38.     ProcessFiles(theFile)
  39.     tell application "EPS Fixer" to quit
  40. end run
  41.